#include<bits/stdc++.h>
#define ll long long
#define re register
using namespace std;
template <typename T> inline void rd(T &x){
	x=0;int f=1;char c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
	for(;isdigit(c);c=getchar())x=(x<<3)+(x<<1)+c-'0';
	x*=f;
}
int n,t,ans;
priority_queue<int>q1,q2;
int main(){
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	rd(n);
	for(re int i=1;i<=n;i++){
		rd(t);
		q1.push(t);
	}
	while(!q1.empty()){
		if(q2.empty()||q2.top()<=q1.top()){
			q2.push(q1.top());
			q1.pop();
		}
		else{
			q2.push(q1.top());
			q2.pop();q1.pop();
		}
	}
	while(!q2.empty()){
		q2.pop();
		ans++;
	}
	cout<<ans<<endl;
	return 0;
}
